/*
 * Masks.java
 *
 * Created on September 20, 2007, 10:36 AM
 *
 * To change this template, choose Tools | Template Manager
 * and open the template in the editor.
 */

package filtros;

/**
 *
 * @author Pizzol
 */
public class Masks {
    
    /** Creates a new instance of Masks */
    private Masks() {
    }
    
 
    public static double [][] sharpness1(int c, int d) {
		double saida[][] = new double[3][3];
		
		for(int i=0; i < 3; i++){
			for(int j=0; j < 3; j++){
				
				if((i==0 && j==0) || (i==0 && j==2) || (i==2 && j==0) || (i==2 && j==2)) {
					saida[i][j] = 0;
				}
				if((i==0 && j==1) || (i==1 && j==0) || (i==2 && j==1) || (i==1 && j==2)) {
					saida[i][j] = -c;
				}
				if((i==1 && j==1)) {
					saida[i][j] = 4*c+d;
				}
			}
		}
		return saida;
	}
	
	public static double [][] sharpness2(int c, int d) {
		double saida[][] = new double[3][3];
		
		for(int i=0; i < 3; i++){
			for(int j=0; j < 3; j++){
				
				if((i==1 && j==1)) {
					saida[i][j] = 8*c+d;
				}else {
					saida[i][j] = -c;
				}
			}
		}
		return saida;
	}

	public static double [][] border1() {
		
		double saida[][] = {{-1/(double)8, -1/(double)8, -1/(double)8},
				{-1/(double)8,    1, -1/(double)8},
				{-1/(double)8, -1/(double)8, -1/(double)8}};
		return saida;
	}
	
	public static double [][] border2() {
		
		double saida[][] = {{-1, -1, -1},
							{ 0,  0,  0},
							{ 1,  1,  1}};
		return saida;
	}

	public static double [][] border3() {
		
		double saida[][] = {{-1,  0, 1},
							{-1,  0, 1},
							{-1,  0, 1}};
		return saida;
	}
	
	public static double [][] border4() {
		
		double saida[][] = {{-1, -1, 0},
							{-1,  0, 1},
							{ 0,  1, 1}};
		return saida;
	}
	
	public static double [][] emboss1() {
		
		double saida[][] = {{0,  0,  0},
							{0,  1,  0},
							{0,  0, -1}};
		return saida;
	}
	
	public static double [][] emboss2() {
		
		double saida[][] = {{0,  0, -1},
							{0,  1,  0},
							{0,  0,  0}};
		return saida;
	}
	
	public static double [][] emboss3() {
		double saida[][] = {{ 0,   0,  2},
							{ 0,  -1,  0},
							{-1,  0,  0}};
		return saida;
	}
	
	public static double [][] gaussiano() {
		double saida[][] = {{1/(double)16,  2/(double)16,  1/(double)16},
							{2/(double)16,  4/(double)16,  2/(double)16},
							{1/(double)16,  2/(double)16,  1/(double)16}};
		return saida;
	}
	
	public static double [][] media(int m, int n) {
		double saida[][] = new double[m][n];
		
		double quociente = m*n;
		
		for(int i=0; i < m; i++){
			for(int j=0; j < n; j++){

				saida[i][j] = 1/(double)quociente;
				
			}
		}
		return saida;
	}
    
}
